package org.dtrd.modules.record.mapper;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.dtrd.config.system.Constant;
import org.dtrd.modules.record.entity.bean.BloodPressureStatisticsBean;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninBloodPressure;

public interface DtrdEntRdBloodPressureMapper extends BaseMapper<DtrdEntRdSigninBloodPressure> {

    List<DtrdEntRdSigninBloodPressure> getBloodPressureRecordsForCharts(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<DtrdEntRdSigninBloodPressure> getAllBloodPressureBetweenTimeByPage(@Param("patientId") int patientId,
                                                                            @Param("startDate") String startDate,
                                                                            @Param("endDate") String endDate,
                                                                            @Param("pageStart") int pageStart,
                                                                            @Param("pageSize") int pageSize);

    List<DtrdEntRdSigninBloodPressure> getAllBloodPressureByPage(@Param("patientId") int patientId,
                                                                 @Param("pageStart") int pageStart,
                                                                 @Param("pageSize") int pageSize);

    List<DtrdEntRdSigninBloodPressure> getAllBloodPressureByDate(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("asc") String asc);

    Integer getBloodPressureRecordDateCount(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    Map<String, String> getBloodPressureRecordsForChartsInApp(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    BloodPressureStatisticsBean getBloodPressureStatisticsBean(@Param("patientId") int patientId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("high") float high, @Param("highDown") float highDown, @Param("low") float low, @Param("lowDown") float lowDown);

    Integer getAvgBloodHighPressure(@Param("patientId") Integer patientId, @Param("startDate") String startOfWeek, @Param("endDate") String endOfWeek);

    Integer getAvgBloodLowPressure(@Param("patientId") Integer patientId, @Param("startDate") String startOfWeek, @Param("endDate") String endOfWeek);

    Integer getAvgBloodHeartrate(@Param("patientId") Integer patientId, @Param("startDate") String startOfWeek, @Param("endDate") String endOfWeek);

    /**
     * 获取第一次血压记录初始值
     * @param patientId
     * @param bloodPressure
     * @return
     */
    Float getFirstBloodPressureValue(Integer patientId, Constant.BloodPressure bloodPressure);
}